package com.ruoyi.biz.api.system.factory;

import com.ruoyi.biz.api.system.RemoteAreaService;
import com.ruoyi.common.core.domain.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class RemoteAreaFallbackFactory implements FallbackFactory<RemoteAreaService> {
    @Override
    public RemoteAreaService create(Throwable cause) {
        log.error("服务调用失败:{}", cause.toString());
        return new RemoteAreaService() {

            @Override
            public R<Long> getDeptIdByAreaCode(String areaId) {
                return R.fail("查询区域异常");
            }
        };
    }
}
